﻿@model Eqwww.Web.Areas.SystemSecurity.Models.VersionLog.CreateViewModel


@{
    ViewData["Title"] = "新建";
    Layout = "~/Views/Shared/_ManageFormLayout.cshtml";
}
<link rel="stylesheet" type="text/css" href="~/lib/froala306/css/froala_editor.pkgd.min.css" />
<link rel="stylesheet" type="text/css" href="~/lib/froala306/css/hack.css" />
<link rel="stylesheet" type="text/css" href="~/lib/froala306/css/plugins/code_view.min.css" />

<form id="form1" class="mdui-m-t-3 mdui-m-b-3">
    <div asp-validation-summary="ModelOnly" class="mdui-textfield-error"></div>
    <div class="mdui-container">

        <div class="mdui-row">

            <div class="mdui-col-xs-12 mdui-col-md-6">
                <div class="mdui-textfield mdui-textfield-floating-label">
                    <label asp-for="Version" class="mdui-textfield-label"></label>
                    <input asp-for="Version" class="mdui-textfield-input mdui-color-grey-100" />
                    <span asp-validation-for="Version" class="mdui-textfield-error"></span>
                </div>
            </div>

            <div class="mdui-col-xs-12">
                <div class="mdui-textfield mdui-textfield-floating-label">
                    <label asp-for="Content" class="mdui-textfield-label"></label>
                    <div id="foeditor">
                    </div>
                    <span asp-validation-for="Content" class="mdui-textfield-error"></span>
                </div>
            </div>


        </div>

    </div>
</form>


@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}

    <script type="text/javascript" src="~/lib/froala306/js/froala_editor.pkgd.min.js"></script>
    <script type="text/javascript" src="~/lib/froala306/js/languages/zh_cn.js"></script>
    <script type="text/javascript" src="~/lib/froala306/js/plugins/code_view.min.js"></script>

    <script>
        var foeditor;
        $(function () {

            foeditor = new FroalaEditor('#foeditor', {
                language: 'zh_cn',
                height: '300',
                toolbarButtons: {
                    'moreText': {
                        'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle', 'clearFormatting']
                    },
                    'moreParagraph': {
                        'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify', 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
                    },
                    'moreRich': {
                        'buttons': ['insertLink', 'insertImage', 'insertVideo', 'insertTable', 'emoticons', 'fontAwesome', 'specialCharacters', 'embedly', 'insertFile', 'insertHR']
                    },
                    'moreMisc': {
                        'buttons': ['undo', 'redo', 'fullscreen', 'print', 'getPDF', 'spellChecker', 'selectAll', 'html', 'help',
                        ],
                        align: 'right'
                    }
                }
            });

        });
        function submitForm() {
            if (!$("#form1").valid()) {
                return false;
            }
            var postData = $('#form1').formSerialize();
            var html = foeditor.html.get(true);
            postData['Content'] = html;
            $.submitForm({
                url: "/SystemSecurity/VersionLog/CreateSubmit",
                param: postData,
                success: function () {
                    $.currentWindow().location.reload();
                }
            });

        };
    </script>
}
